package net.cours.demo;


import javax.servlet.http.HttpSession;

import net.cours.demo.bean.Article;
import net.cours.demo.bean.Panier;

public class PanierManager {
	
	private static PanierManager instance;
	
	public static PanierManager getInstance() {
		if(instance == null) {
			instance = new PanierManager();
		}
		return instance;
	}

	public Panier creerPanier() {
		return new Panier();
	}
	
	public Panier viderPanier() {
		return new Panier();
	}

	public Panier ajouterArticle(Panier panier, Article article) {
		if(!panier.getArticles().containsKey(article.getReference())) {
			panier.getArticles().put(article.getReference(),article);
		}
		return panier;
	}

}
